<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class WechatDelivery extends AbstractMigration
{

    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $this->table('wechat_delivery', ['signed' => false, 'comment' => '微信快递公司列表'])
            ->addColumn('delivery_id', 'string', ['limit' =>32, 'comment' => '快递公司 ID'])
            ->addColumn('delivery_name', 'string', ['comment' => '快递公司名称'])
            ->addColumn('can_use_cash', 'tinyinteger', ['signed' => false, 'comment' => '是否支持散单, 1表示支持'])
            ->addColumn('can_get_quota', 'tinyinteger', ['signed' => false, 'comment' => '是否支持查询面单余额, 1表示支持'])
            ->addColumn('service_type', 'json', ['comment' => '支持的服务类型'])
            ->addColumn('cash_biz_id', 'string', ['limit' => 32, 'comment' => '散单对应的bizid，当can_use_cash=1时有效'])
            ->addTimestamps('create_time', 'update_time')
            ->addIndex(['delivery_id'], ['unique' => true])
            ->create();
    }
}
